<!DOCTYPE html>
<html  class="iframe-h">
<head>
    <meta charset="UTF-8">
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
    <title>回调管理中心</title>
    <link rel="stylesheet" type="text/css" href="../../static/admin/layui/css/layui.css"/>
    <link rel="stylesheet" type="text/css" href="../../static/admin/css/admin.css"/>
</head>
<body  class="iframe-h">
<div class="wrap-container email-wrap clearfix">
    <div class="demoTable">
        taskId：
        <div class="layui-inline">
            <input class="layui-input" name="url" id="search-taskId" autocomplete="off" style="width: 400px;">
        </div>
        <button class="layui-btn" data-type="reload">搜索</button>
        <button class="layui-btn" id="refresh-btn" style="float: right">刷新页面</button>
    </div>
    <table class="layui-hide" id="table_taskLogs"></table>
</div>
<script src="../../static/admin/layui/layui.js" type="text/javascript" charset="utf-8"></script>
<script>
    layui.use('table', function() {
        var table = layui.table;
        table.render({
            elem: '#table_taskLogs'
            ,url:'/manager/getTaskLogs'
            ,method:'post'
            ,cols: [[
                {field:'taskId',title: 'taskId', width: 310}
                ,{field:'createDate',title: '调用时间', width: 170}
                ,{field:'success',title: '是否成功', width: 90
                    ,templet: function(item){
                        return item.success ? '是':'否'
                    }
                }
                ,{field:'responseTxt',title: '响应内容'}
            ]]
            ,id: 'table_taskLogs'
            ,page: true
            ,parseData: function(res){ //将原始数据解析成 table 组件所规定的数据
                return {
                    "code": res.code, //解析接口状态
                    "msg": res.msg, //解析提示文本
                    "count": res.data.count, //解析数据长度
                    "data": res.data.resultList //解析数据列表
                };
            }
        });

        var $ = layui.$, active = {
            reload: function(){
                var taskId = $('#search-taskId');
                //执行重载
                table.reload('table_taskLogs', {
                    page: {
                        curr: 1 //重新从第 1 页开始
                    }
                    ,where: {
                        taskId: taskId.val()
                    }
                });
            }
        };

        $('.demoTable .layui-btn').on('click', function(){
            var type = $(this).data('type');
            active[type] ? active[type].call(this) : '';
        });

        $('#refresh-btn').on('click', function () {
            taskId = $('#search-taskId');
            taskId.val('')
            table.reload('table_taskLogs', {
                page: {
                    curr: 1 //重新从第 1 页开始
                }
                ,where: {
                    taskId: taskId.val()
                }
            });
        })
    });
</script>
</body>
</html>